
package it.intecs.pisa.smarcos.util;

import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import android.util.Log;

public class PatternUtils {
	private static final String TAG = PatternUtils.class.getSimpleName();
	
	Pattern p;
	Matcher m;

	public PatternUtils(){
		p = Pattern.compile("[a-zA-Z]+|\\s|\\W|\\d");
	}
	
	public ArrayList<String> Split(String currentText){

		if (currentText == "" || currentText.length() == 0)
			return null;
		
		ArrayList<String> scrollString;
		scrollString = new ArrayList<String>();
		//Log.d(TAG, "Split - currentText " + currentText);
		Matcher m = p.matcher(currentText);
		while (m.find()) { 
			//Log.d(TAG, "Split - elements " + m.group(0));
			scrollString.add(m.group(0)); 
		}
		return scrollString;
	}	
}